#!/bin/env python

import time
import cv2

pic_path = "../resource/pic/img_002.jpg"
windowName = pic_path

# cv2.namedWindow(windowName, cv2.WINDOW_NORMAL)
# cv2.resizeWindow(windowName, 640, 480)

pic = cv2.imread(pic_path)
cv2.imshow(windowName, pic)

colorspace = [
    cv2.COLOR_BGR2RGBA,
    cv2.COLOR_BGR2BGRA,
    cv2.COLOR_BGR2GRAY,
    cv2.COLOR_BGR2HSV,
    cv2.COLOR_BGR2YUV,
]

cvt_img = cv2.cvtColor(pic, cv2.COLOR_BGR2RGBA)
cv2.imshow('RGBA', cvt_img)
cvt_img = cv2.cvtColor(pic, cv2.COLOR_BGR2BGRA)
cv2.imshow('BGRA', cvt_img)
cvt_img = cv2.cvtColor(pic, cv2.COLOR_BGR2GRAY)
cv2.imshow('GRAY', cvt_img)
cvt_img = cv2.cvtColor(pic, cv2.COLOR_BGR2HSV)
cv2.imshow('HSV', cvt_img)
cvt_img = cv2.cvtColor(pic, cv2.COLOR_BGR2YUV)
cv2.imshow('YUV', cvt_img)

while True:
    if cv2.waitKey(0) == ord('q'):
        break

print('销毁窗口')
cv2.destroyAllWindows()